package com.wiiss.quartz.controller;

import com.alibaba.fastjson.JSONObject;
import com.wiiss.common.constant.Constants;
import com.wiiss.common.domain.AjaxResult;
import com.wiiss.quartz.service.ICleanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 清理过期任务
 */
@RestController
@RequestMapping("/mcs/clean")
public class CleanController {
    @Autowired
    ICleanService cleanService;

    @GetMapping()
    public AjaxResult getClean() {
        return AjaxResult.success(cleanService.selectClean());
    }

    @PostMapping()
    public AjaxResult updateClean(@RequestBody JSONObject jsonObject) {
        return AjaxResult.success(cleanService.updateClean(jsonObject));
    }

    @PostMapping("/cleanLog")
    public AjaxResult cleanLog() {
        cleanService.cleanLog();
        return AjaxResult.success(Constants.SUCCESS_MSG);
    }
}
